/* YFree */
import yFree from './YFree/YFree.js'
/* App自定义 */
import Global from './Global.js'

yFree.yInit((yConfig, app) => {
    app.config.globalProperties.Global = Global;
    app.config.globalProperties.IJkid = Global.IJkid;
    app.config.globalProperties.IFinal = Global.IFinal;
    app.config.globalProperties.AppUtils = Global.AppUtils;

    yConfig.webName = "YFree_Admin";
    yConfig.IP = "http://39.96.46.180:81/gateway_managerApi/managerApi";
    yConfig.interface = "/sbin";
    yConfig.onYHTTPHeader = () => {
        let time = new Date().getTime().toString();
        let userModel = Global.AppUtils.readUserModel();
        return {
            'sign-device': "PC_WEB",
            'sign-version': "100",
            'sign-rst': time,
            'sign-uid': yFree.yIsEmpty(userModel) ? '' : userModel.uid,
            'sign-password': yFree.yIsEmpty(userModel) ? '' : userModel.sign_password,
            'sign-sign': yFree.yIsEmpty(userModel) ? '' : yFree.yMD5(yFree.yMD5(userModel.sign_token) + time)
        }
    };
});
